package com.ybwh.springboot1.controller;

import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.ybwh.springboot1.common.Response;

@RestController
@RequestMapping("/")
public class TestController {
	@RequestMapping("/test")
	public ModelAndView test() {

		ModelAndView mv = new ModelAndView("test");
		mv.addObject("test", 55555555);
		return mv;

	}

	@RequestMapping(value = "/testDate")
	@ResponseBody
	public Response<Object> testDate(@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd") Date date) {
		System.out.println(date);

		return new Response<Object>(Response.FAIL_CODE, " test response");

	}

}
